package com.ruoyi.web.controller.shopping;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.shopping.AllProducts;
import com.ruoyi.system.service.shopping.IAllProductsService ;

@RestController
@RequestMapping("/mall/allProducts")
public class AllProductsController extends BaseController {
    @Autowired
    private IAllProductsService allProductsService;

    /**
     * 查询商品列表
     */
    @GetMapping("/list")
    public TableDataInfo list(AllProducts allProducts) {
        startPage();
        // 注入当前用户ID，用于SQL中的关联查询
        allProducts.setCurrentUserId(SecurityUtils.getUserId());
        List<AllProducts> list = allProductsService.selectAllProductsList(allProducts);
        return getDataTable(list);
    }
}
